package com.hansming.bss.modules.sfc.service;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hansming.bss.common.service.CrudService;
import com.hansming.bss.modules.sfc.dao.ContactsDao;
import com.hansming.bss.modules.sfc.entity.Contacts;

/**
 * 联系人Service
 * @author Hansming
 * @version 2017-09-19
 */
@Service
@Transactional(readOnly = true)
public class ContactsService extends CrudService<ContactsDao,Contacts>{
	
	@Autowired
	private ContactsDao contactsDao;
	
	//根据用户id得到联系人
	public Contacts getByid(String id){
		return contactsDao.getByid(id);
	}
	
	@Transactional(readOnly = false)
	public void insert2(Contacts contacts){
		contactsDao.insert2(contacts);
	}
	
	public List<Contacts> getContactsByuserId(String id){
		return contactsDao.getContactsByuserId(id);
	}

	public void deleteBycontactsid(String id){
		contactsDao.deleteBycontactsid(id);
	}
	
	public Contacts getByidentnum(String identnum,String userId){
		return contactsDao.getByidentnum(identnum,userId);
	}
	
	public List<Contacts> getContactsByUserIdLimit4(String id){
		return contactsDao.getContactsByUserIdLimit4(id);
	}
	//根据用户token得到联系人
	public List<Contacts> getContactsByToken(String token){
		return contactsDao.getContactsByToken(token);
	}
	
}
